package fr.jade.fraclite.orb.factory;

import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.api.factory.GenericFactory;
import org.objectweb.fractal.api.type.ComponentType;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.api.type.TypeFactory;
import org.objectweb.fractal.util.Fractal;

import fr.jade.fraclite.api.ComponentInterface;

public class Util {

  public static Component getCreateHAFactory(Component boot) throws Exception{
    GenericFactory gf = Fractal.getGenericFactory(boot);
    TypeFactory tf = Fractal.getTypeFactory(boot);
    ComponentType t = tf.createFcType(new InterfaceType[] {});
    Component hagf = gf.newFcInstance(t, "hagf", null);
    ((ComponentInterface)hagf).setFcItfGUId(555);
    ((ComponentInterface)Fractal.getGenericFactory(hagf)).setFcItfGUId(666);
    return hagf;
  }
}
